package com.deram.ctin.serv.main.config;

import freemarker.template.TemplateExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhangcm
 * @version 1.0, 2017/9/25
 */
@Configuration
public class FreeMarkerConfig {

    @Bean
    public freemarker.template.Configuration configuration(){
        freemarker.template.Configuration config = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_23);
        config.setDefaultEncoding("UTF-8");
        config.setClassForTemplateLoading(FreeMarkerConfig.class, "/ftl");
        config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
        config.setLogTemplateExceptions(false);
        return config;
    }
}
